package com.woniuxy.controller;

import com.woniuxy.exception.MyException;
import com.woniuxy.service.RbacManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/rbacManager")
public class RbacManagercontroller {
    @Autowired(required = false)
    RbacManagerService rbacManagerService;

    @RequestMapping("/findOne")
    @ResponseBody
    public Map<String, Object> findOne(int id){
        return rbacManagerService.findOne(id);
    }
    @RequestMapping("/findAll")
    @ResponseBody
    public List<Map<String,Object>> findAll(){
        return rbacManagerService.findAll();
    }
    @RequestMapping("/addOne")
    @ResponseBody
    public Integer addOne(@RequestBody Map<String,String> manager){
        return rbacManagerService.save(manager);
    }
}
